package com.lxk.bean;

import com.lxk.utils.PropertiesUtils;

public class Constants {
    public static String AUTHOR;
    public static Boolean IGNORE_TABLE_PREFIX;
    public static String SUFFIX_BEAN_Query;

    //参数bean后缀
    public static String SUFFIX_BEAN_QUERY_FUZZY;
    public static String SUFFIX_BEAN_QUERY_TIME_START;
    public static String SUFFIX_BEAN_QUERY_TIME_END;
    //mappers后缀
    public static String SUFFIX_MAPPERS;

    //需要忽略的属性
    public static String IGNORE_BEAN_TOJSON_FIELDS;
    public static String IGNORE_BEAN_TOJSON_EXPRESSIONS;
    public static String IGNORE_BEAN_TOJSON_CLASS;
    //日期序列化与反序列化
    public static String BEAN_DATE_FORMAT_EXPRESSION;
    public static String BEAN_DATE_FORMAT_CLASS;
    public static String BEAN_DATE_UNFORMAT_EXPRESSION;
    public static String BEAN_DATE_UNFORMAT_CLASS;

    private static String PATH_JAVA = "java";
    private static String PATH_RESOURCES = "resources";

    public static String PACKAGE_BASE;
    public static String PACKAGE_PO;
    public static String PACKAGE_Query;
    public static String PACKAGE_VO;
    public static String PACKAGE_UTILS;
    public static String PACKAGE_ENUMS;
    public static String PACKAGE_EXCEPTION;
    public static String PACKAGE_MAPPERS;
    public static String PACKAGE_SERVICE;
    public static String PACKAGE_SERVICE_IMPL;
    public static String PACKAGE_CONTROLLER;

    public static String PATH_BASE;
    public static String PATH_PO;
    public static String PATH_Query;
    public static String PATH_VO;
    public static String PATH_UTILS;
    public static String PATH_ENUMS;
    public static String PATH_EXCEPTION;
    public static String PATH_MAPPERS;
    public static String PATH_MAPPERS_XML;
    public static String PATH_SERVICE;
    public static String PATH_SERVICE_IMPL;
    public static String PATH_CONTROLLER;

    public static void setBasePath(String basePath) {
        PATH_BASE = basePath + PATH_JAVA;

        //输出文件路径
        //PATH_BASE = PropertiesUtils.getString("path.base");

        PATH_PO = PATH_BASE + "/" + PACKAGE_PO.replace(".", "/");
        PATH_Query = PATH_BASE + "/" + PACKAGE_Query.replace(".", "/");
        PATH_VO = PATH_BASE + "/" + PACKAGE_VO.replace(".", "/");
        PATH_UTILS = PATH_BASE + "/" + PACKAGE_UTILS.replace(".", "/");
        PATH_ENUMS = PATH_BASE + "/" + PACKAGE_ENUMS.replace(".", "/");
        PATH_EXCEPTION = PATH_BASE + "/" + PACKAGE_EXCEPTION.replace(".", "/");
        PATH_MAPPERS = PATH_BASE + "/" + PACKAGE_MAPPERS.replace(".", "/");
        PATH_MAPPERS_XML = basePath + PATH_RESOURCES + "/" + PACKAGE_MAPPERS.replace(".", "/");
        PATH_SERVICE = PATH_BASE + "/" + PACKAGE_SERVICE.replace(".", "/");
        PATH_SERVICE_IMPL = PATH_BASE + "/" + PACKAGE_SERVICE_IMPL.replace(".", "/");
        PATH_CONTROLLER = PATH_BASE + "/" + PACKAGE_CONTROLLER.replace(".", "/");

    }

    static {
        AUTHOR = PropertiesUtils.getString("author");

        //需要忽略的属性
        IGNORE_BEAN_TOJSON_FIELDS = PropertiesUtils.getString("ignore.bean.tojson.fields");
        IGNORE_BEAN_TOJSON_EXPRESSIONS = PropertiesUtils.getString("ignore.bean.tojson.expressions");
        IGNORE_BEAN_TOJSON_CLASS = PropertiesUtils.getString("ignore.bean.tojson.class");
        //日期格式
        BEAN_DATE_FORMAT_EXPRESSION = PropertiesUtils.getString("bean.date.format.expression");
        BEAN_DATE_FORMAT_CLASS = PropertiesUtils.getString("bean.data.format.class");
        BEAN_DATE_UNFORMAT_EXPRESSION = PropertiesUtils.getString("bean.data.unformat.expression");
        BEAN_DATE_UNFORMAT_CLASS = PropertiesUtils.getString("bean.data.unformat.class");

        IGNORE_TABLE_PREFIX = Boolean.valueOf(PropertiesUtils.getString("ignore.table.prefix"));
        SUFFIX_BEAN_Query = PropertiesUtils.getString("suffix.bean.query");

        SUFFIX_BEAN_QUERY_FUZZY = PropertiesUtils.getString("suffix.bean.query.fuzzy");
        SUFFIX_BEAN_QUERY_TIME_START = PropertiesUtils.getString("suffix.bean.query.time.start");
        SUFFIX_BEAN_QUERY_TIME_END = PropertiesUtils.getString("suffix.bean.query.time.end");

        SUFFIX_MAPPERS = PropertiesUtils.getString("suffix.mappers");

        //包名
        PACKAGE_BASE = PropertiesUtils.getString("package.base");
        PACKAGE_PO = PACKAGE_BASE + "." +PropertiesUtils.getString("package.po");
        PACKAGE_Query = PACKAGE_BASE + "." +PropertiesUtils.getString("package.query");
        PACKAGE_VO = PACKAGE_BASE + "." +PropertiesUtils.getString("package.vo");
        PACKAGE_UTILS = PACKAGE_BASE + "." +PropertiesUtils.getString("package.utils");
        PACKAGE_ENUMS = PACKAGE_BASE + "." +PropertiesUtils.getString("package.enums");
        PACKAGE_EXCEPTION = PACKAGE_BASE + "." +PropertiesUtils.getString("package.exception");
        PACKAGE_MAPPERS = PACKAGE_BASE + "." +PropertiesUtils.getString("package.mappers");
        PACKAGE_SERVICE = PACKAGE_BASE + "." +PropertiesUtils.getString("package.service");
        PACKAGE_SERVICE_IMPL = PACKAGE_BASE + "." +PropertiesUtils.getString("package.service.impl");
        PACKAGE_CONTROLLER = PACKAGE_BASE + "." +PropertiesUtils.getString("package.controller");


    }

    // sql类型
    public final static String[] SQL_DATE_TIME_TYPES = new String[]{"datetime", "timestamp", "time"};
    public final static String[] SQL_DATE_TYPES = new String[]{"date", "year", "month", "day", "week", "quarter"};
    public final static String[] SQL_DECIMAL_TYPES = new String[]{"decimal", "double", "float", "numeric"};
    public final static String[] SQL_STRING_TYPES = new String[]{ "char", "varchar", "text", "longtext", "tinytext", "mediumtext", "nchar", "nvarchar", "ntext"};
    public final static String[] SQL_INTEGER_TYPES = new String[]{"int", "integer", "tinyint", "smallint", "mediumint", "bit", "serial"};
    public final static String[] SQL_LONG_TYPES = new String[]{"bigint", "bigserial", "long", "longblob"};


    public static void main(String[] args) {
        //System.out.println(Constants.PACKAGE_PO);
        System.out.println(Constants.PATH_MAPPERS_XML);

    }
}
